<template>
  <view class="vip-benefits" @tap="handleBenefitClick">
    <view class="benefits-container" :style="containerStyle">
      <!-- VIP标签 -->
      <view class="vip-tag">
        <image class="vip-icon" :src="commonStore.baseImageUrl + 'test-yujia/index/vip-icon.png'" mode="aspectFit" />
        <text class="vip-text">开通PLUS会员</text>
        <image class="arrow-right" :src="commonStore.baseImageUrl + 'test-yujia/index/vip-arrow-right.png'"
          mode="aspectFit" />
      </view>

      <!-- 福利项目 -->
      <view class="benefits-items">
        <!-- 补贴福利 -->
        <view class="benefit-item benefit-item-1">
          <text class="benefit-text-1">领800元超级补贴</text>
        </view>

        <!-- 优惠福利 -->
        <view class="benefit-item" >
          <image class="benefit-icon" :src="commonStore.baseImageUrl + 'test-yujia/index/shop-card-icon.png'"
            mode="aspectFit" />

          <view class="benefit-content">
            <view style="display: flex; align-items: center; justify-content: space-between;">
              <text class="main-text">12项福利</text>
              <image class="arrow-right" :src="commonStore.baseImageUrl + 'test-yujia/index/arrow-right-a.png'"
                mode="aspectFit" />
            </view>
            <text class="sub-text">开通PLUS会员即可领取</text>
          </view>

        </view>
        <view class="benefit-item" >
          <image class="benefit-icon" :src="commonStore.baseImageUrl + 'test-yujia/index/shop-card-icon.png'"
            mode="aspectFit" />

          <view class="benefit-content">
            <view style="display: flex; align-items: center; justify-content: space-between;">
              <text class="main-text">12项福利</text>
              <image class="arrow-right" :src="commonStore.baseImageUrl + 'test-yujia/index/arrow-right-a.png'"
                mode="aspectFit" />
            </view>
            <text class="sub-text">开通PLUS会员即可领取</text>
          </view>

        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { useCommonStore } from '@/store'

defineProps({
  containerStyle: {
    type: Object,
    default: () => ({})
  }
})

const commonStore = useCommonStore()

const handleBenefitClick = (index) => {
  // 处理点击事件，可以跳转到相应的福利详情页
  console.log('Benefit clicked:', index)
  uni.navigateTo({
    url: '/pages/subpackages/memberCenter/open-plus'
  })
}
</script>

<style lang="scss">
.vip-benefits {
  .benefits-container {
    background: #B0C56F;
    border-radius: 20rpx;
    position: relative;
  }

  .vip-tag {
    display: flex;
    align-items: center;
    position: absolute;
    top: -4rpx;
    left: 0;
    background: #60702D;
    border-radius: 20rpx 0rpx 25rpx 0rpx;
    color: #E4CEA8;
    height: 52rpx;
    padding: 0 6rpx;

    .vip-icon {
      width: 32rpx;
      height: 26rpx;
    }

    .vip-text {
      font-size: 26rpx;
      font-weight: bold;
      margin-left: 6rpx;
    }

    .arrow-right {
      width: 14rpx;
      height: 16rpx;
      margin-left: 4rpx;
    }
  }

  .benefits-items {
    display: flex;
    align-items: center;


    .benefit-item {
      border-radius: 12rpx;
      padding: 16rpx 4rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;
      color: #fff;
      box-sizing: border-box;

      &::after {
        content: ' ';
        display: block;
        width: 1px;
        height: 92rpx;
        background: rgba(#60702D, 0.3);
        margin-top: 10rpx;
      }

      &:last-child {
        &::after {
          content: ' ';
          display: none;
        }
      }

      .benefit-text-1 {
        font-size: 24rpx;
        margin-top: 20rpx;
        flex-shrink: 0;
        padding: 0 30rpx;
      }

      .benefit-icon {
        width: 84rpx;
        height: 80rpx;
      }

      .benefit-content {
        display: flex;
        flex-direction: column;
        margin-left: 8rpx;


        .main-text {
          font-size: 24rpx;
          font-weight: bold;
        }

        .sub-text {
          font-size: 16rpx;
          margin-top: 4rpx;
        }
      }

      .arrow-right {
        width: 11rpx;
        height: 20rpx;
        margin-left: 4rpx;
        margin-right: 6rpx;
        align-self: flex-start;
        margin-top: 10rpx;
      }


    }

    .benefit-item-1 {
      flex-shrink: 0;
    }
  }
}
</style>
